from sklearn.preprocessing import MinMaxScaler, StandardScaler
import pandas as pd


# 归一化
def minmax_demo():
    df = pd.read_csv("../data1/dating.txt", sep="\t")
    df = df.iloc[:, :-1]
    # 1.实现MinMaxScaler对象
    transfer = MinMaxScaler(feature_range=(2, 3))
    # 2.调用fit_transform
    data = transfer.fit_transform(df)
    print(data)
    print(data.shape)


def standard_demo():
    df = pd.read_csv("../data1/dating.txt", sep="\t")
    df = df.iloc[:, :-1]
    print(df)
    # 1.实现StandardScaler对象
    transfer = StandardScaler()
    # 2.调用fit_transform
    data = transfer.fit_transform(df)
    print(data)
    print(data.shape)


if __name__ == '__main__':
    # minmax_demo()
    standard_demo()
